#ifndef GAMEVIEW_H
#define GAMEVIEW_H

#include "render.h"
#include "gfxitems/gfxItem.h"
#include <QGraphicsView>
#include <QPoint>

class MainWindow;

class GameView : public QGraphicsView, public Render
{
   Q_OBJECT
public:
   explicit GameView(QWidget *parent = 0);
   virtual ~GameView();
   void mousePressEvent(QMouseEvent *event);
   void mouseDoubleClickEvent(QMouseEvent *event);
   void mouseReleaseEvent(QMouseEvent *event);
   void mouseMoveEvent(QMouseEvent *event);
   void wheelEvent(QWheelEvent *event);
   void leaveEvent(QEvent *event);
   void setGame(ClientGame *game);
   void addEntity(ClientEntity *entity);
   void removeEntity(int id);
   void addFX(FX_TYPE type, ClientEntity *entity=0, qreal value=0.0);
   void tick();
   void drawPaths(const PathListType &path);
   void setShowRanges(bool value);
   void setBlendRanges(bool value);
   void setMainWindow(MainWindow *mainWindow);
   void zoom(bool zoomIn);
   void updateCursor(const EntityBaseStats &stats, const qint32 numberIndex);
   void clearCursor();
   void setSelection(const quint32 id, const ENTITY_TYPE type=ENTITY_NONE);

signals:
   void newSelection(ENTITY_TYPE type, quint32 id);
   void placedEntity(ENTITY_TYPE type, QPointF pos, quint32 emitterID=0);

protected:
   QGraphicsScene mScene;
   MainWindow *mMainWindow;
   GFXItem::GFXItemMapType mEntityGfx;
   GFXItem::GFXItemListType mFx;
   float mZoomLevel;
   GFXItem *mCursorItem;
   quint32 mSelectedID;
};

#endif // GAMEVIEW_H
